//
//  OSSettingVC.m
//  ZKPayApp
//
//  Created by 凯朱 on 2024/10/30.
//

#import "OSSettingVC.h"

@interface OSSettingVC ()

@end

@implementation OSSettingVC

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = kLocalString(@"设置");
    _loginBtn.layer.cornerRadius = 25;
    _loginBtn.layer.masksToBounds = YES;
    if (kIsTourst) {
        [_loginBtn setTitle:kLocalString(@"登录") forState:UIControlStateNormal];
    }else{
        [_loginBtn setTitle:kLocalString(@"退出登录") forState:UIControlStateNormal];
    }
}

- (IBAction)loginAction:(id)sender {
    
    if (kIsTourst) {
        [OSTool pushToLogVc];
    }else{
        [self showAlertWithTitle:kLocalString(@"提示") message:kLocalString(@"确定退出登录吗？") andOthers:@[kLocalString(@"取消"),kLocalString(@"确定")] animated:NO action:^(NSInteger index) {
            if (index == 1) {
                [[OSUserManager sharedOSUserManager] clearUserData];
                [[NSNotificationCenter defaultCenter] postNotificationName:@"loginStatusChange" object:nil];
                [self.navigationController popToRootViewControllerAnimated:YES];
                OSTabBarController *tab = [OSTabBarController new];
                [UIApplication sharedApplication].keyWindow.rootViewController = tab;
            }
        }];
    }
}


@end
